<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>ThunarJobOperationHistory: Thunar Internal Functions Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
<link rel="home" href="index.html" title="Thunar Internal Functions Reference Manual">
<link rel="up" href="ch05.html" title="Miscellaneous">
<link rel="prev" href="ThunarJobOperation.html" title="ThunarJobOperation">
<link rel="next" href="thunar-view.html" title="Part III. Main Screen UI Widgets">
<meta name="generator" content="GTK-Doc V1.33.1 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
                  <a href="#ThunarJobOperationHistory.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
                  <a href="#ThunarJobOperationHistory.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_properties">  <span class="dim">|</span> 
                  <a href="#ThunarJobOperationHistory.properties" class="shortcut">Properties</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="ch05.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="ThunarJobOperation.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="thunar-view.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="ThunarJobOperationHistory"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="ThunarJobOperationHistory.top_of_page"></a>ThunarJobOperationHistory</span></h2>
<p>ThunarJobOperationHistory — Manages the logging of job operations (copy, move etc.) and undoing and redoing them</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="ThunarJobOperationHistory.functions"></a><h2>Functions</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="functions_proto_type">
<col class="functions_proto_name">
</colgroup>
<tbody>
<tr>
<td class="function_type">
<a class="link" href="ThunarJobOperationHistory.html" title="ThunarJobOperationHistory"><span class="returnvalue">ThunarJobOperationHistory</span></a> *
</td>
<td class="function_name">
<a class="link" href="ThunarJobOperationHistory.html#thunar-job-operation-history-get-default" title="thunar_job_operation_history_get_default ()">thunar_job_operation_history_get_default</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="ThunarJobOperationHistory.html#thunar-job-operation-history-commit" title="thunar_job_operation_history_commit ()">thunar_job_operation_history_commit</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="ThunarJobOperationHistory.html#thunar-job-operation-history-update-trash-timestamps" title="thunar_job_operation_history_update_trash_timestamps ()">thunar_job_operation_history_update_trash_timestamps</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="ThunarJobOperationHistory.html#thunar-job-operation-history-undo" title="thunar_job_operation_history_undo ()">thunar_job_operation_history_undo</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="ThunarJobOperationHistory.html#thunar-job-operation-history-redo" title="thunar_job_operation_history_redo ()">thunar_job_operation_history_redo</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gboolean</span>
</td>
<td class="function_name">
<a class="link" href="ThunarJobOperationHistory.html#thunar-job-operation-history-can-undo" title="thunar_job_operation_history_can_undo ()">thunar_job_operation_history_can_undo</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gboolean</span>
</td>
<td class="function_name">
<a class="link" href="ThunarJobOperationHistory.html#thunar-job-operation-history-can-redo" title="thunar_job_operation_history_can_redo ()">thunar_job_operation_history_can_redo</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="ThunarJobOperationHistory.properties"></a><h2>Properties</h2>
<div class="informaltable"><table class="informaltable" border="0">
<colgroup>
<col width="150px" class="properties_type">
<col width="300px" class="properties_name">
<col width="200px" class="properties_flags">
</colgroup>
<tbody>
<tr>
<td class="property_type"><span class="type">gboolean</span></td>
<td class="property_name"><a class="link" href="ThunarJobOperationHistory.html#ThunarJobOperationHistory--can-redo" title="The “can-redo” property">can-redo</a></td>
<td class="property_flags">Read</td>
</tr>
<tr>
<td class="property_type"><span class="type">gboolean</span></td>
<td class="property_name"><a class="link" href="ThunarJobOperationHistory.html#ThunarJobOperationHistory--can-undo" title="The “can-undo” property">can-undo</a></td>
<td class="property_flags">Read</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="ThunarJobOperationHistory.other"></a><h2>Types and Values</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="other_proto_type">
<col class="other_proto_name">
</colgroup>
<tbody>
<tr>
<td class="define_keyword">#define</td>
<td class="function_name"><a class="link" href="ThunarJobOperationHistory.html#THUNAR-TYPE-JOB-OPERATION-HISTORY:CAPS" title="THUNAR_TYPE_JOB_OPERATION_HISTORY">THUNAR_TYPE_JOB_OPERATION_HISTORY</a></td>
</tr>
<tr>
<td class="datatype_keyword"> </td>
<td class="function_name"><a class="link" href="ThunarJobOperationHistory.html#ThunarJobOperationHistory-struct" title="ThunarJobOperationHistory">ThunarJobOperationHistory</a></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="ThunarJobOperationHistory.object-hierarchy"></a><h2>Object Hierarchy</h2>
<pre class="screen">    GObject
    <span class="lineart">╰──</span> ThunarJobOperationHistory
</pre>
</div>
<div class="refsect1">
<a name="ThunarJobOperationHistory.description"></a><h2>Description</h2>
<p>The single <a class="link" href="ThunarJobOperationHistory.html" title="ThunarJobOperationHistory"><span class="type">ThunarJobOperationHistory</span></a> instance stores all job operations in a <span class="type">GList</span>
and manages tools to manage the list and the next/previous operations which can be undone/redone */</p>
<p>/* property identifiers */
enum
{
  PROP_0,
  PROP_CAN_UNDO,
  PROP_CAN_REDO,
};</p>
<p>static void thunar_job_operation_history_finalize     (GObject    *object);
static void thunar_job_operation_history_get_property (GObject    *object,
                                                       guint       prop_id,
                                                       GValue     *value,
                                                       GParamSpec *pspec);</p>
<p>struct _ThunarJobOperationHistory
{
  GObject  __parent__;</p>
<p>  /* List of job operations which were logged */
  GList   *job_operation_list;
  gint     job_operation_list_max_size;</p>
<p>  /* since the job operation list, lp_undo and lp_redo all refer to the same memory locations,
which may be accessed by different threads, we need to protect this memory with a mutex */
  GMutex   job_operation_list_mutex;</p>
<p>  /* List pointer to the operation which can be undone */
  GList   *lp_undo;</p>
<p>  /* List pointer to the operation which can be redone */
  GList   *lp_redo;
};</p>
<p>static ThunarJobOperationHistory *job_operation_history;</p>
<p>G_DEFINE_TYPE (ThunarJobOperationHistory, thunar_job_operation_history, G_TYPE_OBJECT)</p>
<p>static void
thunar_job_operation_history_class_init (ThunarJobOperationHistoryClass *klass)
{
  GObjectClass      *gobject_class;</p>
<p>  gobject_class = G_OBJECT_CLASS (klass);
  gobject_class-&gt;get_property = thunar_job_operation_history_get_property;
  gobject_class-&gt;finalize = thunar_job_operation_history_finalize;</p>
<p>  g_object_class_install_property (gobject_class,
                                   PROP_CAN_UNDO,
                                   g_param_spec_boolean ("can-undo",
                                                         "can-undo",
                                                         "can-undo",
                                                         FALSE,
                                                         EXO_PARAM_READABLE));</p>
<p>  g_object_class_install_property (gobject_class,
                                   PROP_CAN_REDO,
                                   g_param_spec_boolean ("can-redo",
                                                         "can-redo",
                                                         "can-redo",
                                                         FALSE,
                                                         EXO_PARAM_READABLE));
}</p>
<p>static void
thunar_job_operation_history_init (ThunarJobOperationHistory *self)
{
  ThunarPreferences *preferences;</p>
<p>  self-&gt;job_operation_list = NULL;
  self-&gt;lp_undo = NULL;
  self-&gt;lp_redo = NULL;</p>
<p>  preferences = <a class="link" href="ThunarPreferences.html#thunar-preferences-get" title="thunar_preferences_get ()"><code class="function">thunar_preferences_get()</code></a>;
  g_object_get (G_OBJECT (preferences), "misc-undo-redo-history-size", &amp;(self-&gt;job_operation_list_max_size), NULL);
  g_object_unref (preferences);</p>
<p>  g_mutex_init (&amp;self-&gt;job_operation_list_mutex);
}</p>
<p>static void
thunar_job_operation_history_finalize (GObject *object)
{
  ThunarJobOperationHistory *history = THUNAR_JOB_OPERATION_HISTORY (object);</p>
<p>  _thunar_return_if_fail (THUNAR_IS_JOB_OPERATION_HISTORY (history));</p>
<p>  g_list_free_full (history-&gt;job_operation_list, g_object_unref);</p>
<p>  g_mutex_clear (&amp;history-&gt;job_operation_list_mutex);</p>
<p>  (*G_OBJECT_CLASS (thunar_job_operation_history_parent_class)-&gt;finalize) (object);
}</p>
<p>static void
thunar_job_operation_history_get_property (GObject    *object,
                                           guint       prop_id,
                                           GValue     *value,
                                           GParamSpec *pspec)
{
  switch (prop_id)
    {
    case PROP_CAN_UNDO:
      g_value_set_boolean (value, <a class="link" href="ThunarJobOperationHistory.html#thunar-job-operation-history-can-undo" title="thunar_job_operation_history_can_undo ()"><code class="function">thunar_job_operation_history_can_undo()</code></a>);
      break;</p>
<p>    case PROP_CAN_REDO:
      g_value_set_boolean (value, <a class="link" href="ThunarJobOperationHistory.html#thunar-job-operation-history-can-redo" title="thunar_job_operation_history_can_redo ()"><code class="function">thunar_job_operation_history_can_redo()</code></a>);
      break;</p>
<p>    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
    }
}</p>
<p>/**
thunar_job_operation_history_get_default:</p>
<p>Returns a reference to the default <a class="link" href="ThunarJobOperationHistory.html" title="ThunarJobOperationHistory"><span class="type">ThunarJobOperationHistory</span></a>
instance.</p>
<p>The caller is responsible to free the returned instance
using <code class="function">g_object_unref()</code> when no longer needed.</p>
</div>
<div class="refsect1">
<a name="ThunarJobOperationHistory.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="thunar-job-operation-history-get-default"></a><h3>thunar_job_operation_history_get_default ()</h3>
<pre class="programlisting"><a class="link" href="ThunarJobOperationHistory.html" title="ThunarJobOperationHistory"><span class="returnvalue">ThunarJobOperationHistory</span></a> *
thunar_job_operation_history_get_default
                               (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
</div>
<hr>
<div class="refsect2">
<a name="thunar-job-operation-history-commit"></a><h3>thunar_job_operation_history_commit ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
thunar_job_operation_history_commit (<em class="parameter"><code><a class="link" href="ThunarJobOperation.html" title="ThunarJobOperation"><span class="type">ThunarJobOperation</span></a> *job_operation</code></em>);</pre>
<p>Commits, or registers, the given thunar_job_operation, adding the job operation
to the job operation list.</p>
<div class="refsect3">
<a name="thunar-job-operation-history-commit.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>job_operation</p></td>
<td class="parameter_description"><p>a <a class="link" href="ThunarJobOperation.html" title="ThunarJobOperation"><span class="type">ThunarJobOperation</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="thunar-job-operation-history-update-trash-timestamps"></a><h3>thunar_job_operation_history_update_trash_timestamps ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
thunar_job_operation_history_update_trash_timestamps
                               (<em class="parameter"><code><a class="link" href="ThunarJobOperation.html" title="ThunarJobOperation"><span class="type">ThunarJobOperation</span></a> *job_operation</code></em>);</pre>
<p>Only updates the timestamps of the latest trash operation
That is needed after 'redo' of a 'trash' operation,
since it requires to set new timestamps (otherwise 'undo' of that operation wont work afterwards)</p>
<div class="refsect3">
<a name="thunar-job-operation-history-update-trash-timestamps.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>job_operation</p></td>
<td class="parameter_description"><p>a <a class="link" href="ThunarJobOperation.html" title="ThunarJobOperation"><span class="type">ThunarJobOperation</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="thunar-job-operation-history-undo"></a><h3>thunar_job_operation_history_undo ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
thunar_job_operation_history_undo (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>Undoes the latest job operation, by executing its inverse</p>
</div>
<hr>
<div class="refsect2">
<a name="thunar-job-operation-history-redo"></a><h3>thunar_job_operation_history_redo ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
thunar_job_operation_history_redo (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>Redoes the last job operation which had been undone (if any)</p>
</div>
<hr>
<div class="refsect2">
<a name="thunar-job-operation-history-can-undo"></a><h3>thunar_job_operation_history_can_undo ()</h3>
<pre class="programlisting"><span class="returnvalue">gboolean</span>
thunar_job_operation_history_can_undo (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
</div>
<hr>
<div class="refsect2">
<a name="thunar-job-operation-history-can-redo"></a><h3>thunar_job_operation_history_can_redo ()</h3>
<pre class="programlisting"><span class="returnvalue">gboolean</span>
thunar_job_operation_history_can_redo (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
</div>
</div>
<div class="refsect1">
<a name="ThunarJobOperationHistory.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="THUNAR-TYPE-JOB-OPERATION-HISTORY:CAPS"></a><h3>THUNAR_TYPE_JOB_OPERATION_HISTORY</h3>
<pre class="programlisting">#define THUNAR_TYPE_JOB_OPERATION_HISTORY (thunar_job_operation_history_get_type ())
</pre>
</div>
<hr>
<div class="refsect2">
<a name="ThunarJobOperationHistory-struct"></a><h3>ThunarJobOperationHistory</h3>
<pre class="programlisting">typedef struct _ThunarJobOperationHistory ThunarJobOperationHistory;</pre>
</div>
</div>
<div class="refsect1">
<a name="ThunarJobOperationHistory.property-details"></a><h2>Property Details</h2>
<div class="refsect2">
<a name="ThunarJobOperationHistory--can-redo"></a><h3>The <code class="literal">“can-redo”</code> property</h3>
<pre class="programlisting">  “can-redo”                 <span class="type">gboolean</span></pre>
<p>can-redo.</p>
<p>Owner: ThunarJobOperationHistory</p>
<p>Flags: Read</p>
<p>Default value: FALSE</p>
</div>
<hr>
<div class="refsect2">
<a name="ThunarJobOperationHistory--can-undo"></a><h3>The <code class="literal">“can-undo”</code> property</h3>
<pre class="programlisting">  “can-undo”                 <span class="type">gboolean</span></pre>
<p>can-undo.</p>
<p>Owner: ThunarJobOperationHistory</p>
<p>Flags: Read</p>
<p>Default value: FALSE</p>
</div>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.33.1</div>
</body>
</html>